﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class my_ascx_articles : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int userno = int.Parse(Request["no"]);
        int cno = int.Parse(Request["cno"]);

        ctpDataContext db = new ctpDataContext();

        var data = from p in db.ct_s_intros
                   join q in db.ct_s_profiles on p.ct_s_no equals q.no
                   where p.create_user_no == userno && q.valid==true && p.ct_no == cno
                   orderby p.addtime descending
                   select new
                   {
                       intro=p.intro,
                       title=q.title,
                       img=q.main_pic_fn.Trim(),
                       no=q.no
                   };

        this.GridView1.DataSource = data.Take(3);
        this.DataBind();

        //this.HyperLink2.NavigateUrl = "~/my/add_article.aspx?no=" + userno + "&cno=" + cno ;
        this.HyperLink3.NavigateUrl = "~/my/more_article.aspx?no=" + userno + "&cno=" + cno;
    }
}
